package com.yang.demo.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.widget.TextView;
import android.widget.Toast;

import com.jaeger.library.StatusBarUtil;
import com.yang.demo.ActivityCollector;
import com.yang.demo.Constant;
import com.yang.demo.MainActivity;
import com.yang.demo.R;
import com.yang.demo.util.rxbus.RxBus;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by yangwenwen on 2018/4/1.
 */
public class ResultActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.result_activity);
        TextView tvName = findViewById(R.id.tv_name);
        tvName.setText("嗨，" + Constant.username);
        ActivityCollector.addActivity(this);
//        MainActivity.instance.finish();
        ButterKnife.bind(this);
        RxBus.get().register(this);
        StatusBarUtil.setColor(this, ContextCompat.getColor(this, R.color.main_blue), 50);
        StatusBarUtil.setDarkMode(this);

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        RxBus.get().unRegister(this);
    }

    @OnClick(R.id.tv_start)
    public void onViewClicked() {
        //开启报告
        Intent intent = new Intent(this, ResultActivity2.class);
        startActivity(intent);
        finish();
    }


    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            return true;
        }
        return false;
    }
}